﻿@{
    Layout = null;
}
@using CoreData
@using Helper
@model List<Product>
@if (Model != null && Model.Count() > 0)
{<ul class="row-product">
    @foreach (var item in Model)
    {
        <li class="column-product">
            <div class="column-inner">
                <div class="product-thumbnail">
                    <a href="@Url.RouteUrl("product_details", new { Id = item.ID, Link = item.Link })" title="@item.Name">
                        <img src="/Media/Product/@item.Image" alt="@item.Image" />
                    </a>
                </div>
                <div class="tool-payment">
                    <a href="@Url.Action("BuyNow", "ShoppingCart", new { ProductId = item.ID, Amount = 1 })" class="btn gray btn-pay">
                        Mua ngay</a>
                    <input type="button" ProductId="@item.ID" Amount="1" type="button" class="btn btn-add-cart" title="Thêm vào giỏ hàng">
                </div>
                <div class="product-details">
                    @{
        var productname = item.Name;
        if (productname.Length > 25)
        {
            productname = productname.Substring(0, 25) + "...";
        }

                        <div class="product-price">
                            <span>@StringHelper.FormatVND(int.Parse(item.Price.ToString()))</span></div>
                        <h1 class="product-title">
                            <a href="@Url.RouteUrl("product_details", new { Id = item.ID, Link = item.Link })">@productname</a></h1>
                    }
                    <div class="small-detail">
                        <span class="detail-item">
                            <label>
                                Hạn dùng:</label><span>@item.Shelf</span></span> <span class="detail-item">
                                    <label>
                                        Xuất sứ:</label><span>Đà Lạt</span></span>
                    </div>
                </div>
            </div>
        </li>
    }
    </ul>
}